package com.kestrel.space.core.config;

import com.kestrel.space.common.constants.COSConstants;
import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.region.Region;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yebolin
 * @date 2024/8/26 
 */
@Configuration
public class CosConfig {
    @Bean
    public COSClient initCOSClient(){
        COSCredentials cred = new BasicCOSCredentials(COSConstants.SECRET_ID, COSConstants.SECRET_KEY);
        Region region = new Region(COSConstants.REGION);
        ClientConfig clientConfig = new ClientConfig(region);
        return new COSClient(cred, clientConfig);

    }
}
